<template>
  <div>
    <van-nav-bar title="我的收藏" left-arrow @click-left="back" />

    <div class="dy-img" v-if="list.length==0">
      <img src="../../assets/img/view.png" alt />
      <p>暂无收藏</p>
    </div>

    <div class="dy-box" v-else>
      <div
        slot="item"
        class="item"
        v-for="(item, index) in list"
        :key="index"
        @click="onItem(item)"
      >
        <div class="collect-icon" @click.stop="onUnstar(item)"></div>
        <div class="top">
          <p class="title">{{item.title}}</p>
          <p class="time">
            <span class="duration">
              <img class="clock" src="../../assets/nz.png" alt />
              <span>{{item.start_play_date | fomartTime('MM月dd日 hh:mm')}} ~ {{item.end_play_date | fomartTime('MM月dd日 hh:mm')}}</span>
            </span>
            <span>共{{item.section_num}}课时</span>
          </p>
          <ul class="teachers">
            <li :key="index">
              <img :src="item.teachersAvatar" />
              <span>{{item.teachers}}</span>
            </li>
          </ul>
        </div>
        <div class="bottom">
          <div class="info">
            <p class="sign">{{item.sales_num}}人已报名</p>
            <div class="price">
              <p class="price-line" v-if="item.underlined_price">
                <!-- <img class="price-ico" :src="$store.state.config.price_ico" /> -->
                <!-- {{item.underlined_price | toFixPrice}} -->
              </p>
              <p class="price-now">
                <!-- <img class="price-ico" :src="$store.state.config.price_ico" /> -->
                <i class="iconfont icon-jinbi"></i>
                {{item.price | toFixPrice}}
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { collectlist, nocollect } from "../../request/http";
export default {
  name: "",
  data() {
    return {
      list: []
    };
  },
  props: [],
  components: {},
  mounted() {
    collectlist({ page: 1, limit: 10, type: 1 }).then(res => {
      console.log(res);
      this.list = res.list;
      console.log(this.list);
    });
  },
  methods: {
    back() {
      this.$router.go(-1);
    }
  }
};
</script>

<style scoped>
.dy-img {
  margin: 80px auto;
  width: 150px;
  text-align: center;
}
.dy-img > img {
  width: 100%;
}
.dy-img > p {
  font-size: 4vw;
  color: #8c8c8c;
  margin-top: 10px;
}
.item{
  background: #fff;
  border-radius: 10px;
  width: 95%;
  margin: 10px auto;
  padding: 10px;
}
.time>.duration>img{
  width: 15px;
  height: 15px;
}
.top>.title{
  font-size: 18px;
}
.top>.time{
  color: #666;
  margin-top: 10px;
}
.top>.time>span{
  margin-left: 5px;
}
.teachers{
  margin-top: 15px;
}
.teachers>li{
  display: flex;
  align-items: center;
}
.teachers>li>span{
  margin-left: 10px;
}
.teachers>li>img{
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.bottom>.info{
  display: flex;
  margin-top: 10px;
  padding: 10px 0 10px 0;
  border-top: 1px solid #ccc;
}
.bottom>.info>.sign{
  color: #888;
}
.bottom>.info>.price>.price-now{
  float: right;
  text-align: right;
  color: red;
  width: 250px;
  font-size: 16px;
}
</style>